﻿using EFCore事务示例同时向两张表新增数据.Data;
using EFCore事务示例同时向两张表新增数据.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace EFCore事务示例同时向两张表新增数据.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProcessDataController : ControllerBase
    {
        public ProcessDataController(ProcessData data)
        {
            Data = data;
        }

        public ProcessData Data { get; }



        /// <summary>
        /// 添加数据,使用事务示例
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public int AddData()
        {
           return Data.AddData();
        }
    }
}
